#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<unistd.h>


#define TPATH "teacher_info.ini"
#define SPATH "student_info.ini"

char user_name[16];
char pass_word[10];

typedef struct teacher_info
{
    int ID;
    int age;
    int class;
    char name[16];
    char duty[16];
    char teaching[16];
    char pass_word[10];
}T_INFO;

typedef struct teacher_link
{
    int ID;
    int age;
    int class;
    char name[16];
    char duty[16];
    char teaching[16];
    char pass_word[10];
	struct teacher_link  *pre;
	struct teacher_link *next;
}T_LINK;

typedef struct student_info
{
    int ID;
    int math_score;
    int english_score;
    int c_score;
    int age;
    int class;
    int line_num;
	char name[16];
    char pass_word[10];
}S_INFO;

typedef struct student_link
{
    int ID;
    int math_score;
    int english_score;
    int c_score;
    int age;
    int class;
    int line_num;
	char name[16];
    char pass_word[10];
	struct student_link  *pre;
	struct student_link  *next;
}S_LINK;


struct regist_info
{
    char name[16];
    char pass_word[10];
};

//******************以下主页面main里的函数*****************//
void welcome();
void welcome_chose_enter_login();
void exit_system(T_LINK **head_teacher,S_LINK **head_student);
void system_admin_reboot();

//******************以上主页面main里的函数******************************//

//****************以下学生里的函数***************************//
//查看教师帐户函数里的函数

void student_look_list_teacher(T_LINK *head_teacher,S_LINK *head_student);
void student_search_teacher_byID(T_LINK *head_teacher,S_LINK *head_student);
void student_search_teacher_byname(T_LINK *head_teacher,S_LINK *head_student);


void student_login(T_LINK **head_teacher,S_LINK **head_student);
void student_login_success();
void student_logout();
void student_home(T_LINK **head_teacher,S_LINK **head_student);

//主页面函数里的函数
void manage_my_info(T_LINK **head_teacher,S_LINK **head_student);
void student_look_user_info(T_LINK *head_teacher,S_LINK *head_student);

//查看帐户信息函数里的函数
void student_look_teacher_info(T_LINK *head_teacher,S_LINK *head_student);
void student_look_student_info(T_LINK *head_teacher,S_LINK *head_student);

//查看学生帐户函数里的函数
void student_look_list_student(T_LINK *head_teacher,S_LINK *head_student);
void student_search_student_byID(T_LINK *head_teacher,S_LINK *head_student);
void student_search_student_byname(T_LINK *head_teacher,S_LINK *head_student);
void student_search_student_byclass(T_LINK *head_teacher,S_LINK *head_student);


//************************以上学生里的函数*********************//


//***************************以下系统管理员里的函数*****************************//
//查看教师帐户函数里的函数
void copy_student_link(S_LINK*head_student,S_LINK **head_new);

void free_teacher_link(T_LINK **head_teacher);
void free_student_link(S_LINK **head_student);
void look_list_teacher(T_LINK *head_teacher,S_LINK *head_student);
void search_teacher_byID(T_LINK *head_teacher,S_LINK *head_student);
void search_teacher_byname(T_LINK *head_teacher,S_LINK *head_student);

//管理员登录函数
void sys_admin_login(T_LINK **head_teacher,S_LINK **head_student);
void sys_admin_login_success();
void sys_admin_logout();
void sys_admin_home(T_LINK **head_teacher,S_LINK **head_student);

//管理员主页面函数里的函数
void manage_regist_apply();
void manage_low_level_user(T_LINK **head_teacher,S_LINK **head_student);
void look_users_info(T_LINK *head_teacher,S_LINK *head_student);

//查看帐户信息函数里的函数
void look_teacher_info(T_LINK *head_teacher,S_LINK *head_student);
void look_student_info(T_LINK *head_teacher,S_LINK *head_student);
void look_list_manager();

//查看学生帐户函数里的函数
void look_list_student(T_LINK *head_teacher,S_LINK *head_student);
void search_student_byID(T_LINK *head_teacher,S_LINK *head_student);
void search_student_byname(T_LINK *head_teacher,S_LINK *head_student);
void search_student_byclass(T_LINK *head_teacher,S_LINK *head_student);


void sore_byline_num(S_LINK **head_student);

void read_teacher_info(T_LINK **head_teacher);//读取教师文件内容至链表
void read_student_info(S_LINK **head_student);//读取学生文件内容至链表

void save_teacher_info(T_LINK *head);
void save_student_info(S_LINK *head);

//***********************以上系统管理员里的函数****************************//

//************************以下教师里的函数******************************//
//查看教师帐户函数里的函数

void teacher_look_list_teacher(T_LINK *head_teacher,S_LINK *head_student);
void teacher_search_teacher_byID(T_LINK *head_teacher,S_LINK *head_student);
void teacher_search_teacher_byname(T_LINK *head_teacher,S_LINK *head_student);


void teacher_login(T_LINK **head_teacher,S_LINK **head_student);
void teacher_login_success();
void teacher_logout();
void teacher_home(T_LINK **head_teacher,S_LINK **head_student);

//主页面函数里的函数
void manage_my_and_student_info(T_LINK **head_teacher,S_LINK **head_student);
void teacher_look_user_info(T_LINK *head_teacher,S_LINK *head_student);

//查看帐户信息函数里的函数
void teacher_look_my_info(T_LINK *head_teacher,S_LINK *head_student);
void teacher_look_student_info(T_LINK *head_teacher,S_LINK *head_student);

//查看学生帐户函数里的函数
void teacher_look_list_student(T_LINK *head_teacher,S_LINK *head_student);
void teacher_search_student_byID(T_LINK *head_teacher,S_LINK *head_student);
void teacher_search_student_byname(T_LINK *head_teacher,S_LINK *head_student);
void teacher_search_student_byclass(T_LINK *head_teacher,S_LINK *head_student);

//********************以上教师里的函数*******************************//


